#include <cstdio>
#include <cstdlib>
#include <ctime>

using namespace std;

const int n=5, q=5;

void makeData() {
    FILE *f=fopen("two.in", "w");
    fprintf(f, "%d %d\n", n, q);
    for (int i=1; i<=n; i++) {
        fprintf(f, "%d %d\n", rand()%1000+1, rand()%1000+1);
    }
    for (int i=1; i<=q; i++) {
        fprintf(f, "%d %d %d\n", rand()%2+1, rand()%1000+1, rand()%1000+1);
    }
    fclose(f);
}

int main() {
    srand(time(0));
    for (;;) {
        makeData();
        if (system("./bin")) {
            printf("RE!\n");
            return -1;
        } else if (system("./check")) {
            printf("CE!\n");
            return -1;
        } else if (system("cmp two.out check.out")) {
            printf("WA!\n");
            return -1;
        }
    }
    return 0;
}
